package com.gitee.wsl.ext.array


fun BooleanArray.getTrueIndices(): List<Int> {
    val res = ArrayList<Int>(size)
    for (i in indices)
        if (this[i]) res.add(i)
    return res
}


fun <T: Any> Array<out T?>.filterNotNullAllOrNull(): List<T>? {
    val res: MutableList<T> = ArrayList(this.size)
    for (value in this) {
        value ?: return null
        res.add(value)
    }
    return res
}